import 'package:flutter/foundation.dart';
import 'package:flutter/services.dart';

import 'andserver_flutter2_platform_interface.dart';

/// An implementation of [AndserverFlutter2Platform] that uses method channels.
class MethodChannelAndserverFlutter2 extends AndserverFlutter2Platform {
  /// The method channel used to interact with the native platform.
  @visibleForTesting
  final methodChannel = const MethodChannel('andserver_flutter2');

  @override
  Future<bool?> setRootPath(String rootPath) async {
    final status = await methodChannel.invokeMethod<bool>('setRootPath',rootPath);
    return status;
  }

  @override
  Future<bool?> startServer() async {
    final result = await methodChannel.invokeMethod<bool>('startServer');
    return result;
  }

  @override
  Future<bool?> stopServer() async {
    final result = await methodChannel.invokeMethod<bool>('stopServer');
    return result;
  }
}
